<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div class=" definewidth m20">
		<form action="/sys_admin/article/zhs_articlelist/" method="get" name="form" id="form" class="form-inline definewidth m20">
  			标题：<input type="text" id="title" name="title" value="<?php echo $title?>" />
  			所属类别：<select id="nid" name="nid">
				<option value="0">--请选择类别--</option>
				<?php if($site_array){
					foreach($site_array as $key=>$v){
						?>
				<option <?php if($key == $nid){?> selected="selected" <?php }?> value="<?php echo $key;?>">
					<?php echo $v;?>
				</option>
					<?php
					}
				}
				?>
			</select>
  			<button type="button" class="btn btn-primary"  onclick="this.form.submit();" >查询</button>
  			<button type="button" class="btn btn-success"  onclick="href('/sys_admin/article/add_view/');" >添加页面</button>
  		</form>
		<table class="table table-bordered table-hover definewidth m10">
			 <thead>
			    <tr>
			        <th >序号</th>
					<th >所属类别</th>
					<th >标题</th>
					<th >添加时间</th>
					<th >显示时间</th>
					<th >浏览次数</th>
					<th >是否显示</th>
					<th >操作</th>
			    </tr>
			   </thead>
			     <?php foreach($article_list as $key=>$article){?>
				  <tr id="row_<?php echo $article['id'];?>">
					<td> <?php echo $article['id'];?></td>
					<td ><?php echo $article['name'];?></td>
					<td ><?php echo $article['title'];?></td>
					<td ><?php echo date('Y-m-d H:i',$article['add_time']);?></td>
					<td ><?php echo date('Y-m-d H:i',$article['ptime']);?></td>
					<td ><?php echo $article['hits'];?></td>
					<td ><?php echo $article_show[$article['is_show']];?></td>
					<td>
						<a href="/sys_admin/article/edit_view/<?php echo $article['id'];?>">编辑</a>
						<a href="javascript:if(confirm('确定删除文章？')){remove(<?php echo $article['id'];?>);}">删除</a>
					</td>
				  </tr>
			  <?php }?>
			  	<tr>
			  	<td colspan="8"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links();?></td>
			  	</tr>
		</table>
</div>
<script>
function remove(id){
	$.ajax({
		type: "post",
		url: "/sys_admin/article/remove/",
		data: "id="+id,
		success: function(msg){
			$("#dialog" ).dialog();
			if(msg == 1){
				$("#msg").html("删除成功！");
				$("#row_"+id).hide();
			}else{
				$("#msg").html("删除失败，请联系管理员！");
			}
			setTimeout(function(){
				$("#dialog" ).dialog("close");
			},3000);
		},
		dataType: "text"
	});
}

</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
